package com.me.study.jdk8.functionInterface;

import org.junit.Test;

import java.util.function.BiConsumer;
import java.util.function.Function;

/**
 * JDK1.8 新特性：函数式接口<p>
 *
 * @author ME
 * @date   2019/7/3
 */
public class TestFunctionInterface {

    @Test
    public void test() {
        Function<String, String> f = Function.identity();
        System.out.println(f.apply("check?????"));
    }

    /** Lambda表达式 */
    @Test
    public void test2() {
        MyFunction myf = (String content, String name) -> System.out.println(content + ", " + name);
        myf.sayHello("Hello", "Tom");

        // 基于 jdk8 内置的 FunctionalInterface 实现
        BiConsumer<String, String> biConsumer = (content, name) -> System.out.println(content + ", " + name);
        biConsumer.accept("Hello", "Tom");
    }
    
}
